package service.impl;

import dao.UserDao;
import dao.impl.UserDaoImpl;
import entity.User;
import service.UserService;

import java.util.List;

public class UserServiceImpl implements UserService {
    private static UserDao userDao = new UserDaoImpl(User.class);
    @Override
    public User getById(String id){
        return userDao.getById(id);
    }
    @Override
    public List<User> list(){
        return userDao.list();
    }
    @Override
    public void update(User user){
        userDao.updateById(user);
    }
    @Override
    public void remove(User user){
        userDao.deleteById(user);
    }

    @Override
    public User getByUsername(String username) {
        User user = userDao.getByUsername(username);
        return user;
    }

    @Override
    public User getNamePasswordByUsername(String username) {
        return userDao.getNamePasswordByUsername(username);
    }

    @Override
    public List<User> getUsersByNameLikeKeyword(String keyword) {
        return userDao.getUsersByNameLikeKeyword(keyword);

    }
}
